<template>
  <div>
    <el-row>
      <el-button>默认按钮</el-button>
      <el-button type="primary" @click="open1">查找用户</el-button>
      <el-button type="success" @click="open2">保存用户</el-button>
      <el-button type="info" @click="open3">信息按钮</el-button>
      <el-button type="warning" @click="open4">警告按钮</el-button>
    </el-row>
  </div>
</template>

<script>
import {get,postJson} from "@/common/js/axios"
export default {
    methods: {
      open1() {
        get("/token/find",{uid:2},2).then(res => {
          if ('code' in res) {
            console.log(res);
            this.$message({
              showClose: true,
              message: '查找用户'
            });
          }
          
        });
        
      },

      open2() {
        postJson("/token/save",{id: "",username:"test",password:"test"},1).then(res => {
          if ('code' in res) {
            console.log(res);
            this.$message({
              showClose: true,
              message: '保存用户',
              type: 'success'
            });
          }
          
        });
        
      },

      open3() {
        this.$message({
          showClose: true,
          message: '警告哦，这是一条警告消息',
          type: 'warning'
        });
      },

      open4() {
        this.$message({
          showClose: true,
          message: '错了哦，这是一条错误消息',
          type: 'error'
        });
      }
    }
  }
</script>

<style>

</style>